package com.yvan.demo.proj2;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.yvan.elasticjob.ReloadableElasticSimpleCron;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by xiaoEight on 2018/6/20.
 */
@ReloadableElasticSimpleCron("elasticjob.test-cron")
@Component
@Slf4j
public class ReloadMyJob implements SimpleJob {

    private static AtomicInteger COUNTER = new AtomicInteger(0);

    @Override
    public void execute(ShardingContext shardingContext) {
        log.info("v:{} c:{}", COUNTER.incrementAndGet(), shardingContext.toString());
    }
}
